package com.example.day12.homework;

public class PrimeNumberCount {



    private  int i=2;
    private  int j=0;
    private  int count=0;
    public  synchronized void  priCount(int []arr){
        for( i=2;i<arr.length;i++){
            for(j=2;j<i;j++){
                if(arr[i]%j==0){
                    break;
                }
            }
            if(j==i){
                count++;
            }
        }
        System.out.println("质数个数有："+count+"个");
    }
}
class   TestPri{
    public static void main(String[] args) {
        int [] arr=new int[150000];
        for (int i=0;i<=149999;i++){
            arr[i]=i;
        }


        PrimeNumberCount pri=new PrimeNumberCount();
        new Thread(()->{
            pri.priCount(arr);
        }).start();


    }
}
